import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sz/components/sz-appBar.dart';
import 'package:sz/tools/tools.dart';

// 求职攻略
class StrategyPage extends StatefulWidget {
  const StrategyPage({super.key});

  @override
  State<StrategyPage> createState() => _StrategyPage();
}

class _StrategyPage extends State<StrategyPage> {
  List<Map<String, dynamic>> listOne = [
    {'title': '职业百科', 'imageUrl': 'images/imgs/zhipin/zybk.png', 'key': 1},
    {'title': '黑话词典', 'imageUrl': 'images/imgs/zhipin/hhcd.png', 'key': 2},
    {'title': '面试技巧', 'imageUrl': 'images/imgs/zhipin/msjq.png', 'key': 3},
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: SzColor.f4f4f4,
      appBar: const SzAppBar(
        title: '求职攻略',
      ),
      body: ListView(
        children: [
          buildOne(),
          buildTwo(),
          Container(
            padding: EdgeInsets.symmetric(
              horizontal: rpx(24),
              vertical: rpx(24),
            ),
            child: Text(
              '职业专场',
              style: TextStyle(
                fontWeight: FontWeight.bold,
                fontSize: setSp(34),
              ),
            ),
          ),
          buildThree()
        ],
      ),
    );
  }

  Padding buildThree() {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: rpx(24)),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Container(
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                      color: SzColor.primary,
                      borderRadius: BorderRadius.circular(
                        rpx(10),
                      ),
                    ),
                    width: rpx(6),
                    height: rpx(28),
                  ),
                  SizedBox(
                    width: rpx(10),
                  ),
                  const Text(
                    '软件开发',
                    style: TextStyle(fontWeight: FontWeight.w700),
                  )
                ],
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Text(
                    '查看更多',
                    style: TextStyle(
                      color: const Color(0xff94a0c1),
                      fontSize: rpx(26),
                    ),
                  ),
                  Icon(
                    AliIcon.qingxuanzeyoujiantou,
                    color: const Color(0xff94a0c1),
                    size: setSp(22),
                  )
                ],
              ),
            ],
          ),
          SizedBox(
            height: rpx(10),
          ),
          Padding(
            padding: EdgeInsets.symmetric(vertical: rpx(12)),
            child: ClipRRect(
              borderRadius: BorderRadius.circular(rpx(10)),
              child: Image.network(
                'http://192.168.31.218:31102/smart/img/39.png',
                height: rpx(300),
                width: getScreenWidth,
                fit: BoxFit.cover,
              ),
            ),
          ),
          Padding(
            padding: EdgeInsets.symmetric(vertical: rpx(12)),
            child: ClipRRect(
              borderRadius: BorderRadius.circular(rpx(10)),
              child: Image.network(
                'http://192.168.31.218:31102/smart/img/39.png',
                height: rpx(300),
                width: getScreenWidth,
                fit: BoxFit.cover,
              ),
            ),
          )
        ],
      ),
    );
  }

  Container buildTwo() {
    return Container(
      margin: EdgeInsets.symmetric(horizontal: rpx(24)),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: listOne
            .map(
              (e) => InkWell(
                onTap: () {
                  Get.toNamed(
                    '/pages-zhipin/strategy/list',
                    arguments: {
                      'type': e['key'],
                    },
                  );
                },
                child: Container(
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(rpx(20)),
                    color: Colors.white,
                  ),
                  padding: EdgeInsets.symmetric(
                    horizontal: rpx(52),
                    vertical: rpx(50),
                  ),
                  child: Column(
                    children: [
                      Image.asset(
                        e['imageUrl'],
                        width: rpx(114),
                        height: rpx(114),
                      ),
                      SizedBox(
                        height: rpx(16),
                      ),
                      Text(e['title'])
                    ],
                  ),
                ),
              ),
            )
            .toList(),
      ),
    );
  }

  Padding buildOne() {
    return Padding(
      padding: EdgeInsets.all(
        rpx(24),
      ),
      child: Image.asset(
        'images/imgs/zhipin/qzgl.png',
        width: getScreenWidth,
        height: rpx(320),
      ),
    );
  }
}
